package com.blb.community.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("zy_owner_room")
public class ZyOwnerRoom implements Serializable {
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long ownerRoomId;

  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long communityId;
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long buildingId;
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long unitId;
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long roomId;
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long ownerId;
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long houseId;

  private String ownerType;
  private String roomStatus;
  private String createBy;
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private LocalDateTime createTime;
  private String updateBy;
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private LocalDateTime updateTime;
  private String remark;

  @TableField(exist = false)
  private String communityName;   // 小区名称
  @TableField(exist = false)
  private String buildingName;    // 楼栋名称
  @TableField(exist = false)
  private String unitName;        // 单元名称
  @TableField(exist = false)
  private String roomName;        // 房间名称
  @TableField(exist = false)
  private String ownerRealName;   // 业主姓名

  public ZyOwnerRoom(Long ownerRoomId, Long communityId, Long buildingId, Long unitId, Long roomId, Long ownerId, Long houseId, String ownerType, String roomStatus, String createBy, LocalDateTime createTime) {
    this.ownerRoomId = ownerRoomId;
    this.communityId = communityId;
    this.buildingId = buildingId;
    this.unitId = unitId;
    this.roomId = roomId;
    this.ownerId = ownerId;
    this.houseId = houseId;
    this.ownerType = ownerType;
    this.roomStatus = roomStatus;
    this.createBy = createBy;
    this.createTime = createTime;
  }
}
